package scenic.study.basic_knowledge;

import org.apache.log4j.Logger;
import org.junit.Test;
import scenic.MyLogger;

import java.util.Random;

/**
 * Created by scenic on 2017/2/17.
 */
public class RandomSeedTest {
    Logger logger = MyLogger.get(RandomSeedTest.class);

    private void printRandom(Random random) {
        for (int i = 0; i < 50; i++) {
            int r = random.nextInt();
            System.out.print(r + "\t");
        }
        System.out.println();
    }
    @Test
    public void testRandomSeed() {

        Random random = new Random();

        printRandom(random);
        printRandom(random);
        printRandom(random);
        logger.debug("now with setSeed");

        random.setSeed(10);
        printRandom(random);
        printRandom(random);
        printRandom(random);


    }

}
